// 递归判断列表，把最后的children设为undefined
export function getTreeData(data, childrenName) {
  for (let i = 0; i < data.length; i++) {
    if (data[i][childrenName].length == 0) {
      // children若为空数组，则将children设为undefined
      data[i][childrenName] = undefined
    } else {
      // children若不为空数组，则继续 递归调用 本方法
      getTreeData(data[i][childrenName], childrenName)
    }
  }
  return data
}
